package org.example.order.listener;

import org.example.core.to.mq.OrderTo;
import org.example.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author 小杰_cc
 * @version 1.0
 */
@Service
@RabbitListener(queues = "order.release.order.queue")
public class OrderCloseListener {

    @Autowired
    private OrderService orderService;

    @RabbitHandler
    public void handleCloseOrder(OrderTo order) {
        System.out.println("关闭订单");
        orderService.closeOrder(order);
    }
}